import 'package:flutter/material.dart';
import 'package:jiaju_flutter/routes.dart';
import 'package:jiaju_flutter/widgets/comm_swiper.dart';
import 'package:jiaju_flutter/widgets/index_navigator.dart';
import 'package:jiaju_flutter/widgets/info/info_widget.dart';
import 'package:jiaju_flutter/widgets/recommond/recommond.dart';
import 'package:jiaju_flutter/widgets/search_app_bar.dart';

final indexItemList = [
  IndexNavigatorItem("整租", "static/images/icon_tab_home_selected.png"),
  IndexNavigatorItem("合租", "static/images/icon_tab_matching_selected.png"),
  IndexNavigatorItem("找房", "static/images/icon_tab_mine_selected.png"),
  IndexNavigatorItem("找工作", "static/images/icon_tab_order_selected.png"),
];

final recommondList = [
  RecommondItem(
      "家住回龙观归属的感觉家住回龙观归属的感觉", "static/images/icon_tab_order_selected.png"),
  RecommondItem("家住回龙观归属的感觉", "static/images/icon_tab_order_selected.png"),
  RecommondItem("家住回龙观归属的感觉", "static/images/icon_tab_order_selected.png"),
  RecommondItem("家住回龙观归属的感觉", "static/images/icon_tab_order_selected.png"),
];

final infoList = [
  InfoItem(
      "家住回龙观归属的感觉家住回龙观归属的感觉",
      "https://gimg2.baidu.com/image_search/src=http%3A%2F%2Fblog.sina.com.cn%2Fpic%2F44f59d727e4f484157caa&refer=http%3A%2F%2Fblog.sina.com.cn&app=2002&size=f9999,10000&q=a80&n=0&g=0n&fmt=jpeg?sec=1627885615&t=be671983b1bd48cabb435c0b84380487",
      "2020-10-21 10:22:30"),
  InfoItem(
      "家住回龙观归属的感觉家住回龙观归属的感觉",
      "https://gimg2.baidu.com/image_search/src=http%3A%2F%2Fblog.sina.com.cn%2Fpic%2F44f59d727e4f484157caa&refer=http%3A%2F%2Fblog.sina.com.cn&app=2002&size=f9999,10000&q=a80&n=0&g=0n&fmt=jpeg?sec=1627885615&t=be671983b1bd48cabb435c0b84380487",
      "2020-10-21 10:22:30"),
  InfoItem(
      "家住回龙观归属的感觉家住回龙观归属的感觉",
      "https://gimg2.baidu.com/image_search/src=http%3A%2F%2Fs9.sinaimg.cn%2Fbmiddle%2F436277f8ga8458f989968%26690&refer=http%3A%2F%2Fs9.sinaimg.cn&app=2002&size=f9999,10000&q=a80&n=0&g=0n&fmt=jpeg?sec=1627885615&t=c8479d1c51f6103089e93b8794ad9739",
      "2020-10-21 10:22:30"),
  InfoItem(
      "家住回龙观归属的感觉家住回龙观归属的感觉",
      "https://gimg2.baidu.com/image_search/src=http%3A%2F%2Fblog.sina.com.cn%2Fpic%2F44f59d727e4f484157caa&refer=http%3A%2F%2Fblog.sina.com.cn&app=2002&size=f9999,10000&q=a80&n=0&g=0n&fmt=jpeg?sec=1627885615&t=be671983b1bd48cabb435c0b84380487",
      "2020-10-21 10:22:30"),
  InfoItem(
      "家住回龙观归属的感觉家住回龙观归属的感觉",
      "https://gimg2.baidu.com/image_search/src=http%3A%2F%2Fs9.sinaimg.cn%2Fbmiddle%2F436277f8ga8458f989968%26690&refer=http%3A%2F%2Fs9.sinaimg.cn&app=2002&size=f9999,10000&q=a80&n=0&g=0n&fmt=jpeg?sec=1627885615&t=c8479d1c51f6103089e93b8794ad9739",
      "2020-10-21 10:22:30"),
  InfoItem(
      "家住回龙观归属的感觉家住回龙观归属的感觉",
      "https://gimg2.baidu.com/image_search/src=http%3A%2F%2Fblog.sina.com.cn%2Fpic%2F44f59d727e4f484157caa&refer=http%3A%2F%2Fblog.sina.com.cn&app=2002&size=f9999,10000&q=a80&n=0&g=0n&fmt=jpeg?sec=1627885615&t=be671983b1bd48cabb435c0b84380487",
      "2020-10-21 10:22:30"),
  InfoItem(
      "家住回龙观归属的感觉家住回龙观归属的感觉家住回龙观归属的感觉家住回龙观归属的感觉",
      "https://gimg2.baidu.com/image_search/src=http%3A%2F%2Fs9.sinaimg.cn%2Fbmiddle%2F436277f8ga8458f989968%26690&refer=http%3A%2F%2Fs9.sinaimg.cn&app=2002&size=f9999,10000&q=a80&n=0&g=0n&fmt=jpeg?sec=1627885615&t=c8479d1c51f6103089e93b8794ad9739",
      "2020-10-21 10:22:30"),
];

class HomePage extends StatelessWidget {
  const HomePage({Key key}) : super(key: key);

  @override
  Widget build(BuildContext context) {
    var size = MediaQuery.of(context).size;
    var width = size.width;
    var height = size.height;
    return Scaffold(
      appBar: SearchAppBar(),
      body: Container(
        width: width,
        height: height,
        child: ListView(
          children: [
            CommSwiper(),
            IndexNavigator(
              itemList: indexItemList,
              onTap: (index) => {},
            ),
            Recommond("房屋推荐", recommondList, onTap: (index) => {}),
            InfoWidget(
              infoList,
              label: "最新资讯",
            ),
          ],
        ),
      ),
    );
  }
}
